<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<html>
	<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript">
        function on_mod_worker(index){
          var rows = $('#worker_table').datagrid('getRows');
		  $('#deptno').val(rows[index].deptno);
		  $('#workerno').val(rows[index].workerno);
		  $('#identifyno').val(rows[index].identifyno);
		  $('#identifyno_val').val(rows[index].identifyno);
		  $('#deptno_val').val(rows[index].deptno);
		  $('#name').val(rows[index].name);
		  $('#telephone').val(rows[index].telephone);
		  $('#address').val(rows[index].address);
		  $('#job').val(rows[index].job);
		  $('#sex').combobox('setValue', rows[index].sex);
		  $('#specflag').combobox('setValue', rows[index].specflag);			  
		  $('#workerstatus1').combobox('setValue', rows[index].workerstatus);	 
          $('#mod_worker_detail_panel').window('open');
          $('#workerno').focus();
        }
        function on_mod_worker_ui(value,row,index){
          return '<a href="#" class="edtclass" onclick="on_mod_worker('+index+')">修改</a>';
        }
        function on_dept_node_clicked(node){
          if (node==null)return;
          var includeflag=$('#include_down_dept').attr('checked');
          var obj = {deptno:node.id,includedown:includeflag};
  	      new_data_grid('#worker_table',make_worker_table_fields(
  	      	'修改',on_mod_worker_ui),'queryWorkersByDept.action',obj,16);
        }
    	$(document).ready(function(){
    	    var sel_dept_panel=$('#sel_worker_dept_pane').panel();
    	    set_dept_panel_ctrl(sel_dept_panel,'depttree');    	    
			//含下级机构勾选框
  			$('#include_down_dept').change(function(){
  			  var node=$('#depttree').tree('getSelected');
  			  on_dept_node_clicked(node);
  			});

    		$('#depttree').tree({url:'queryDeptTree.action',onClick:on_dept_node_clicked,
    			onLoadError: function(){alert('系统错误，服务器可能已关闭！')}});
     		$('#mod_worker_panel').panel({onClose:function(){
          		$("#sel_worker_dept_pane").panel("destroy");
     		}});
     		
     		set_worker_query_action(null,'#worker_table','修改',on_mod_worker_ui,
     			'queryWorkersByIdnoOrName.action',16);
    	});
    </script>
	</head>
	<body>
	<s:include value="modworkerdetail.jsp"></s:include>
    <div id="mod_worker_panel" collapsible="false" fit="true" title="修改员工" resizable="false"
    	collapsible="false" minimizable="false" maximizable="false" closable="true" 
    	icon="icon-save" class="jquery_panel">
    	<table width="100%" height="94%">
    		<tr>
    			<td width="260px"><div id="sel_worker_dept_pane" collapsible="false" fit="true" 
    				title="选择员工机构" resizable="false" collapsible="false" minimizable="false" 
    				maximizable="false" noheader="false" closable="false"
    				style="margin:0px;padding:0px;overflow-y:scroll">
    				<ul id="depttree"></ul></div></td>
    			<td>
    			<table width="100%" height="100%">
    				<tr valign="top" height="20"><td class="param_form_css">
    					<s:include value="/app/query_param.jsp"/></td></tr>
    				<tr valign="top"><td ><table id="worker_table" title="员工基本信息表" singleSelect="true" 
    					fit="true" fitColumns="true"></table>
    				</td>
    				</tr>
    			</table>
 				</td>
    		</tr>
    	</table>
    </div>
    
    </body>
</html>